# coding:utf-8
# 

import glog, glb
import account_mgr, role_mgr, event_mgr, battlearray_mgr, mission_mgr, skill_mgr


def on_complete_mission (params, account, role):
	glog.log('on_complete_mission ' + repr(params))

	mission_id = params[0]
	stars = params[1]
	battle_data = [2]

	# col: TODO 校验战斗数据

	res, errmsg = mission_mgr.complete_mission(role.id, mission_id, stars, battle_data)
	if res:
		data = {
			'battle_result' : mission_mgr.get_mission_award(mission_id),
		}
		return glb.return_ok(data)
	else:
		return glb.return_err(errmsg)


	"""
	res, errmsg = card_mgr.card_level_up(role.id, card_id, to_drops)
	if res:
		data = {
			'card_data' : _get_card_data(role),
		}
		return glb.return_ok(data)
	else:
		return glb.return_err(errmsg)
	"""
